<template>
  <view class="modal-wrap">
    <u-popup
      :show="show_pop"
      :overlay="true"
      mode="center"
      :closeable="false"
      :closeOnClickOverlay="true"
      @close="onClose"
      @open="onOpen"
      :safeAreaInsetBottom="true"
      round="16">
      <view class="cus-center-pop-box">
        <view class="pop-title">确定取消该订单吗？</view>
        <!-- <view class="pop-body">
					<view class="tip">
						<view class="tip-text">
							{{cancelTip}}
						</view>
					</view>
				</view> -->
        <view class="pop-foot">
          <view class="btns flex-between">
            <view class="btn-qx flex-center" @click="show_pop = false">
              取消
            </view>
            <view class="btn-qr flex-center" @click="doConfirm()">确认</view>
          </view>
        </view>
      </view>
    </u-popup>
  </view>
</template>
<script>
export default {
  components: {},
  data() {
    return {
      show_pop: false,
      order_id: "",
      info: {},
    };
  },
  methods: {
    init(info) {
      this.info = info;
      this.order_id = this.info.id;
      this.show_pop = true;
    },
    onClose() {
      this.show_pop = false;
    },
    onOpen() {},
    doConfirm() {
      this.showLoading({
        title: "订单取消中",
        disClose: 1,
      });
      this.$api({
        url: "/service.php",
        method: "get",
        data: {
          action: "orders_cancel",
          id: this.order_id,
        },
      }).then((res) => {
        this.hideLoading();
        this.$alert(res);
        if (res.code == 200) {
          this.$emit("confirm", this.order_id);
          this.show_pop = false;
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
// 通用选项弹窗
.cus-center-pop-box {
  padding: 60upx 24rpx 0;
  width: 686rpx;
  background: #ffffff;
  border-radius: 32rpx;

  .pop-title {
    text-align: center;
    font-weight: bold;
    font-size: 28rpx;
    color: #000000;
  }

  .pop-body {
    margin-top: 30rpx;
    padding: 0 60rpx;

    .tip {
      font-family: PingFang SC, PingFang SC;
      font-weight: 400;
      font-size: 24rpx;
      color: #000000;
      line-height: 1.6;
      text-align: center;

      .tip-text {
        font-family: PingFang SC, PingFang SC;
        font-weight: 400;
        font-size: 24rpx;
        color: #000000;
        line-height: 1.6;
        text-align: center;

        & + .tip-text {
          margin-top: 20rpx;
        }
      }
    }
  }

  .pop-foot {
    margin-top: 60rpx;

    .btns {
      .btn-qx {
        width: 306rpx;
        height: 80rpx;
        background: #f6f6f6;
        border-radius: 40rpx 40rpx 40rpx 40rpx;
        font-weight: 400;
        font-size: 28rpx;
        color: #000000;
      }

      .btn-qr {
        width: 306rpx;
        height: 80rpx;
        background: #f49c0d;
        border-radius: 40rpx 40rpx 40rpx 40rpx;
        font-weight: 400;
        font-size: 28rpx;
        color: #ffffff;
      }
    }
  }
}
</style>
